/*    */ package com.thtfpc.stroke.screening.config;
/*    */ 
/*    */ import org.springframework.context.annotation.Bean;
/*    */ import org.springframework.context.annotation.Configuration;
/*    */ import org.springframework.web.util.UriComponentsBuilder;
/*    */ import springfox.documentation.builders.ApiInfoBuilder;
/*    */ import springfox.documentation.builders.PathSelectors;
/*    */ import springfox.documentation.builders.RequestHandlerSelectors;
/*    */ import springfox.documentation.service.ApiInfo;
/*    */ import springfox.documentation.spi.DocumentationType;
/*    */ import springfox.documentation.spring.web.paths.AbstractPathProvider;
/*    */ import springfox.documentation.spring.web.paths.Paths;
/*    */ import springfox.documentation.spring.web.plugins.Docket;
/*    */ import springfox.documentation.swagger2.annotations.EnableSwagger2;

/*    */ @Configuration
/*    */ @EnableSwagger2
/*    */ public class Swagger2
/*    */ {
/*    */   @Bean
/*    */   public Docket createRestApi() {
/* 32 */     return (new Docket(DocumentationType.SWAGGER_2)).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.thtfpc.stroke.screening.controller")).paths(PathSelectors.any()).build();
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   private ApiInfo apiInfo() {
/* 40 */     return (new ApiInfoBuilder()).title("spn工程接口文档").description("目前处于初版状态").termsOfServiceUrl("http://www.baidu.com/").version("1.0").build();
/*    */   }
/*    */   
/*    */   class BasePathAwareRelativePathProvider
/*    */     extends AbstractPathProvider
/*    */   {
/*    */     private String basePath;
/*    */     
/*    */     public BasePathAwareRelativePathProvider(String basePath) {
/* 49 */       this.basePath = basePath;
/*    */     }
/*    */ 
/*    */     
/*    */     protected String applicationPath() {
/* 54 */       return this.basePath;
/*    */     }
/*    */ 
/*    */     
/*    */     protected String getDocumentationPath() {
/* 59 */       return "/";
/*    */     }
/*    */ 
/*    */     
/*    */     public String getOperationPath(String operationPath) {
/* 64 */       UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromPath("/");
/* 65 */       return Paths.removeAdjacentForwardSlashes(uriComponentsBuilder
/* 66 */           .path("").build().toString());
/*    */     }
/*    */   }
/*    */ }